/**
 * 
 */
package name.marz.to.go.btree.ui.swing;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;

import name.marz.to.go.btree.node.Node;


/**
 * @author masaru-gotou
 *
 */
public class GraphicsConfigration {
	private static final GraphicsConfigration the_instance = new GraphicsConfigration();
	private int nodeHorizontalMirgin = 10;
	private int nodeVerticalMirgin = 10;
	private Font font = new Font(Font.SANS_SERIF,Font.PLAIN,9);

	private GraphicsConfigration() {
	}
	
	public static final GraphicsConfigration getInstance() {
		return the_instance;
	}
	
	public int getNodeHorizontalMirgin() {
		return nodeHorizontalMirgin;
	}

	public void setNodeHorizontalMirgin(int levelMirgin) {
		this.nodeHorizontalMirgin = levelMirgin;
	}

	public int getNodeVerticalMirgin() {
		return nodeVerticalMirgin;
	}

	public void setNodeVerticalMirgin(int nodeVerticalMirgin) {
		this.nodeVerticalMirgin = nodeVerticalMirgin;
	}

	public int getPointerWidth() {
		return 5;
	}
	
	public int getNodeHeight() {
		return 15;
	}
	
	public Dimension getBounds(Node node) {
		int nodeh = getNodeHeight();
		int pointerw = getPointerWidth();
		int keyw = getKeyWidth();
		
		int nodew = node.getMaxKeys() * (keyw + pointerw) + pointerw;
		return new Dimension(nodew,nodeh);
	}

	public int getKeyWidth() {
		return 20;
	}
	
	public Font getFont() {
		return font;
	}
	
	public Point getRootPoint() {
		return new Point(200,20);
	}
}
